package com.psy.counseling.controller;


import com.psy.counseling.entity.Permission;
import com.psy.counseling.service.impl.PermissionServiceImpl;
import com.psy.counseling.service.impl.RoleServiceImpl;
import com.psy.counseling.vo.DeleteVO;
import com.psy.counseling.vo.PageVO;
import com.psy.counseling.vo.ResultVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 梁学儒
 * @since 2022-05-31
 */
@RestController
@RequestMapping("/api/permission")
public class PermissionController {
    @Resource
    private PermissionServiceImpl permissionService;

    @PostMapping("/addPermission")
    public ResultVo addPermission(@RequestBody Permission permission) {
        return permissionService.addPermission(permission);
    }

    @DeleteMapping("/deletePermission")
    public ResultVo deletePermission(@RequestBody DeleteVO deleteVO) {
        return permissionService.deletePermission(deleteVO);
    }

    @GetMapping("/getPermission")
    public ResultVo getPermission(Permission permission, PageVO page) {
        return permissionService.listPermissions(permission,page);
    }

    @PostMapping("/updatePermission")
    public ResultVo updatePermission(@RequestBody Permission permission) {
        return permissionService.updatePermission(permission);
    }

}

